﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
    AutoEventWireup="true" CodeBehind="Edit.aspx.cs" Inherits="SurveyHost.Views.Paragraph.Edit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent"
    runat="server">
    <div class="post">
        <h1 class="title">
            Edit a paragraph
        </h1>
        <p class="byline">
            Edit paragraph
            <%=ViewData.Model.Name %>
        </p>
        <div class="entry">
            <%using (Html.BeginForm("Save", "Paragraph", new { name = ViewData.Model.Name }))
              { %>
              <%= Html.AntiForgeryToken() %>
            <div>
                <%= Html.TextArea("paragraph", ViewData.Model.Text, new { rows = "10", cols = "120" })%>
            </div>
            <button id="subby" type="submit">
                Save</button>
            <%} %>
        </div>
    </div>
    <%if (false)
      {/*js hack*/ %><script src="../../Scripts/jquery-1.2.6-vsdoc.js"
          type="text/javascript"></script><%} %>

    <script type="text/javascript">
        $(document).ready(function() {
            var done = false;
            $("#subby").attr("disabled", "disabled");
            $("#paragraph").keydown(function() {
                if (done) return;
                $("#subby").attr("disabled", "");
                window.onbeforeunload = function() { return "Leaving now may cause you to lose youru work."; };
                done = true;
            });
            $("#subby").click(function() { window.onbeforeunload = null; });
        });
    </script>

</asp:Content>
